<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>peach.pso.acc.StandardPSO</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="peach-module.html">Package&nbsp;peach</a> ::
        <a href="peach.pso-module.html">Package&nbsp;pso</a> ::
        <a href="peach.pso.acc-module.html">Module&nbsp;acc</a> ::
        Class&nbsp;StandardPSO
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="peach.pso.acc.StandardPSO-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class StandardPSO</h1><p class="nomargin-top"><span class="codelink"><a href="peach.pso.acc-pysrc.html#StandardPSO">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_peach_ps_2" name="uml_class_diagram_for_peach_ps_2">
<area shape="rect" id="node1" href="peach.pso.acc.Accelerator-class.html" title="Base class for accelerators." alt="" coords="117,6,208,50"/>
<area shape="rect" id="node179" href="peach.pso.acc.StandardPSO-class.html#cp" title="Velocity adjustment constant associated with the particle best values." alt="" coords="17,95,309,113"/>
<area shape="rect" id="node179" href="peach.pso.acc.StandardPSO-class.html#cg" title="Velocity adjustment constant associated with the global best values." alt="" coords="17,113,309,132"/>
<area shape="rect" id="node179" href="peach.pso.acc.StandardPSO-class.html#__init__" title="Initializes the accelerator." alt="" coords="17,135,309,153"/>
<area shape="rect" id="node179" href="peach.pso.acc.StandardPSO-class.html#__call__" title="Computes the new velocities for every particle in the swarm. This method receives the velocities as a list or a vector of the velocities (a n&#45;dimensional vector in each line) or each particle in a swarm and computes, for each one of them, a new velocity." alt="" coords="17,153,309,172"/>
<area shape="rect" id="node2" href="peach.pso.acc.StandardPSO-class.html" title="Standard PSO Accelerator" alt="" coords="5,70,320,178"/>
</map>
  <img src="uml_class_diagram_for_peach_ps_2.gif" alt='' usemap="#uml_class_diagram_for_peach_ps_2" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<p>Standard PSO Accelerator</p>
<p>This class implements a method for changing the velocities of particles in
a particle swarm. The standard way is to retain information on local bests
and the global bests, and update the velocity based on that.</p>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.pso.acc.StandardPSO-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">ps</span>,
        <span class="summary-sig-arg">vmax</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">cp</span>=<span class="summary-sig-default">2.05</span>,
        <span class="summary-sig-arg">cg</span>=<span class="summary-sig-default">2.05</span>)</span><br />
      Initializes the accelerator.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.pso.acc-pysrc.html#StandardPSO.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="peach.pso.acc.StandardPSO-class.html#__call__" class="summary-sig-name">__call__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">v</span>)</span><br />
      Computes the new velocities for every particle in the swarm. This method
receives the velocities as a list or a vector of the velocities (a
<tt class="rst-docutils literal">n</tt>-dimensional vector in each line) or each particle in a swarm and
computes, for each one of them, a new velocity.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="peach.pso.acc-pysrc.html#StandardPSO.__call__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__sizeof__</code>,
      <code>__str__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== INSTANCE VARIABLES ==================== -->
<a name="section-InstanceVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="cp"></a><span class="summary-name">cp</span><br />
      Velocity adjustment constant associated with the particle best values.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="cg"></a><span class="summary-name">cg</span><br />
      Velocity adjustment constant associated with the global best values.
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">ps</span>,
        <span class="sig-arg">vmax</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">cp</span>=<span class="sig-default">2.05</span>,
        <span class="sig-arg">cg</span>=<span class="sig-default">2.05</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.pso.acc-pysrc.html#StandardPSO.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  Initializes the accelerator.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>ps</code></strong> - A reference to the Particle Swarm that should be updated. This
class, in instantiation, will assume that the position of the
particles in the moment of creation are the local best. The
objective function is computed for all particles, and the values
saved for reference in the future. Also, at the same time, the
global best is computed.</li>
        <li><strong class="pname"><code>cp</code></strong> - The velocity adjustment constant associated with the particle best
values. Defaults to 2.05.</li>
        <li><strong class="pname"><code>cg</code></strong> - The velocity adjustment constant associated with the global best
values. Defaults to 2.05. The defaults in the <tt class="rst-docutils literal">cp</tt> and <tt class="rst-docutils literal">cg</tt>
parameters are such that the inertia weight in the constrition
method satisfies <tt class="rst-docutils literal">cp + cg &gt; 4</tt>. Please, look in the bibliography
for more information.</li>
    </ul></dd>
    <dt>Overrides:
        object.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__call__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__call__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">v</span>)</span>
    <br /><em class="fname">(Call operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="peach.pso.acc-pysrc.html#StandardPSO.__call__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  Computes the new velocities for every particle in the swarm. This method
receives the velocities as a list or a vector of the velocities (a
<tt class="rst-rst-docutils literal rst-docutils literal">n</tt>-dimensional vector in each line) or each particle in a swarm and
computes, for each one of them, a new velocity.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>v</code></strong> - A list or a vector of velocities, where each velocity is one line of
the vector or one element of the list.</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>A vector of the same size as the argument with the updated velocities.
The returned vector is returned as a bidimensional array.</dd>
    <dt>Overrides:
        <a href="peach.pso.acc.Accelerator-class.html#__call__">Accelerator.__call__</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="peach-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a href="http://code.google.com/p/peach">Peach - Computational Intelligence for Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Jul 31 16:59:45 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
